package cn.calm.swing.osgi.file.New.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

import org.osgi.framework.BundleContext;

import cn.calm.swing.osgi.api.DefaultMenuService;

public class NewMenuService extends DefaultMenuService {
	private JMenuItem menu = new JMenuItem("New");
	public NewMenuService(final BundleContext context) {
		menu.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				WizardDialog dia=context.getService(context.getServiceReference(WizardDialog.class));
				
				dia.setVisible(true);
			}
		});
	}

	@Override
	public JMenuItem getMenu() {
		return menu;
	}

	@Override
	public int getIndex() {
		return 0;
	}
}
